// 测试js的函数柯里化
function mycurry (fn) {
  return function curried (...args) {
    if (args.length >= fn.length) {
      return fn.apply(this, args);
    } else {
      return function (...args2) {
        return curried.apply(this, [...args, ...args2]);
      }
    }
  }
}

function add (a, b, c) {
  return a + b + c;
}

const result = mycurry(add);

console.log(result(1, 2)(3));